package com.ylr.send.common.enums;

import com.ylr.base.common.dto.NameValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-06-15 11:03:39
 * className: SmsCodeEnum
 * version: 1.0
 * description:
 */
@Getter
@AllArgsConstructor
public enum SmsCodeEnum {

    /*
        必须保证枚举对象的value值唯一
     */

    LOGIN("login", "用户登录短信验证码模板"),
    ;

    /**
     * 值
     */
    private final String value;

    /**
     * 名称
     */
    private final String name;

    /**
     * 获取枚举列表
     */
    public static List<NameValue<String>> getEnumList() {
        List<NameValue<String>> nameValueList = Stream.of(values()).map(smsCodeEnum -> new NameValue<>(smsCodeEnum.name, smsCodeEnum.value)).collect(Collectors.toList());
        Collections.reverse(nameValueList);
        return nameValueList;
    }
}
